<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('资源使用申请列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<input id="resourceId" name="resourceId" th:field="*{resourceId}"  type="hidden">
					<div class="select-list">
						<ul>
							<li>
								申请人名称：<input type="text" name="applyUserName"/>
							</li>
							<li>
								申请状态：
								<select name="status" th:with="type=${@dict.getType('bus_resource_apply_status')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li>
								审核人名称：<input type="text" name="auditUserName"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:busResourceApply:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var auditFlag = [[${@permission.hasPermi('system:busResourceApply:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:busResourceApply:remove')}]];
        var prefix = ctx + "system/busResourceApply";

		var datas = [[${@dict.getType('bus_resource_apply_status')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                removeUrl: prefix + "/remove",
                modalName: "资源使用申请",
		        showExport: true,
				sortName: "applyTime",
				sortOrder: "desc",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'applyUserName',
					title : '申请人名称',
					sortable: true
				},
				{
					field: 'status',
					title: '申请状态',
					align: "left",
					sortable: true,
					formatter: function(value, item, index) {
						return $.table.selectDictLabel(datas, item.status);
					}
				},
				{
					field : 'applyTime', 
					title : '申请时间',
					sortable: true
				},
				{
					field : 'applyRemark', 
					title : '申请备注',
					sortable: true
				},
				{
					field : 'auditUserName', 
					title : '审核人名称',
					sortable: true
				},
				{
					field : 'auditTime', 
					title : '审核时间',
					sortable: true
				},
				{
					field : 'auditRemark', 
					title : '审核意见',
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
						actions.push("<a class='btn btn-warning btn-xs " + auditFlag + "' href='javascript:void(0)' onclick='auditApply(" + row.applyId + ")'><i class='fa fa-search'></i>审核</a> ");
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.applyId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });

		/* 资源管理-审核申请 */
		function auditApply(applyId) {
			var url = ctx + 'system/busResourceApply/audit/' + applyId;
			$.modal.openTab("审核资源使用申请", url);
		}
    </script>
</body>
</html>